<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/templates/template_admin.xhtml">
        <ui:define name="content">
            <h:form styleClass="jsfcrud_list_form">    
                <h1><h:outputText value="List Account"/></h1>
                <h:outputLabel value="#{acmb.message}"/>
                <p:dataTable id="dataTable" value="#{acmb.accountList()}" var="item" paginator="true" rows="5"  
                             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                             rowsPerPageTemplate="3,5,10,15">
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="UserName"/>
                        </f:facet>
                        <h:outputText value="#{item.userName}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Password"/>
                        </f:facet>
                        <h:outputText value="#{item.password}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="IsChangedPassword"/>
                        </f:facet>
                        <h:selectOneMenu id="isChangedPassword" value="#{item.isChangedPassword}" disabled="true">
                            <f:selectItem itemLabel="Yes" itemValue="#{true}"/>
                            <f:selectItem itemLabel="No" itemValue="#{false}" />
                        </h:selectOneMenu>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Role"/>
                        </f:facet>
                        <h:selectOneMenu id="role" value="#{item.role}" disabled="true">
                            <f:selectItem itemLabel="Admin" itemValue="1"/>
                            <f:selectItem itemLabel="HR Group" itemValue="2" />
                            <f:selectItem itemLabel="Inter Viewer" itemValue="3" />
                        </h:selectOneMenu>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="EmployeeID"/>
                        </f:facet>
                        <h:outputText value="#{item.employeeID.firstName} #{item.employeeID.lastName}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Action"/>
                        </f:facet>
                        <h:commandLink value="View" action="#{acmb.acView(item)}"/><br/>
                        <h:commandLink value="Edit" action="#{acmb.acEdit(item)}"/><br/>
                        <h:commandLink value="Delete" action="#{acmb.deleteAccount(item)}" onclick="return confirm('Are you sure delete not?')"/><br/>
                    </p:column>
                </p:dataTable>
                <p:commandButton action="Create" value="Create"/>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
